package com.liuzu.esys.service.impl;


import com.liuzu.esys.bo.PrerogativesBo;
import com.liuzu.esys.mapper.PrerogativeMapper;
import com.liuzu.esys.pojo.Prerogative;
import com.liuzu.esys.service.PrerogativeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service("PrerogativeService")
public class PrerogativeServiceImpl implements PrerogativeService {
    @Autowired
    private PrerogativeMapper prerogativeMapper;

    @Override
    public List<PrerogativesBo> prerogativeExcelData(Prerogative prerogative) {
       List<Prerogative> prerogatives =  prerogativeMapper.PrerogativeList(prerogative);
        List<PrerogativesBo> prerogativebos = prerogatives.stream()
                .map((pre) -> {
                    PrerogativesBo prerogativesBo = new PrerogativesBo();
                    prerogativesBo.setId(pre.getId());
                    prerogativesBo.setVip_privilege(pre.getVip_privilege());
                    prerogativesBo.setVip_name(pre.getVip_name());
                    prerogativesBo.setVip_number(pre.getVip_number());
                    return prerogativesBo;
                }).collect(Collectors.toList());
        return prerogativebos;
    }
}
